package cn.fengsweb.tokyotyrant
{
	import cn.fengsweb.tokyotyrant.define.TokyoTyrantQueryFunctionName;
	
	import flash.utils.ByteArray;

	internal class PutOne
	{
		private var _sendBytes:ByteArray;
		
		public function get sendBytes():ByteArray
		{
			return _sendBytes;
		}
		
		public function PutOne(key:String, obj:Object)
		{
			var query:TokyoTyrantQuery	= new TokyoTyrantQuery(TokyoTyrantQueryFunctionName.PUT);
			
			var vbuf:ByteArray	= new ByteArray();
				vbuf.writeBytes(Util.string2Bytes(key));
				
				query.addArguments(vbuf);
				
			for(var key1:* in obj){
				query.addArguments(Util.string2Bytes(key1));
				query.addArguments(Util.string2Bytes(obj[key1]));
			}
				
			_sendBytes	= query.sendBytes;
		}
	}
}